using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Public_Signin : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        if (Login1.RememberMeSet)
        {
            HttpCookie ui = new HttpCookie("userinfo");
            if (Roles.IsUserInRole(Login1.UserName, "admin"))
            {
                ui.Values["userrole"] = "admin";
            }
            if (Roles.IsUserInRole(Login1.UserName, "employee"))
            {
                ui.Values["userrole"] = "employee";
            }
            ui.Values["username"] = Login1.UserName;
            ui.Expires = DateTime.Now.AddDays(15);

            Response.Cookies.Add(ui);
        }

        if (Roles.IsUserInRole(Login1.UserName, "admin"))
        {
            Session.Add("username", Login1.UserName);
            Response.Redirect("../Admin/Admin.aspx");
        }
        if (Roles.IsUserInRole(Login1.UserName, "employee"))
        {
            Session.Add("username", Login1.UserName);
            Response.Redirect("../Employee/Employee.aspx");
        }
    }
}
